<?php
/* -----------------------------------------------------------------
 *                        Aveghe My Blog
 * -----------------------------------------------------------------
 * Aveghe My Blog: made your blog easy!
 * Copyright (C) 2008 Elia Contini
 * 
 * Aveghe My Blog is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * Aveghe My Blog is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */

require_once 'aveghe/views/helpers/MainMenu.php';

$meta    = $this->head('meta'   , 'admin', $this->preferences);
$style   = $this->head('style'  , 'admin', $this->preferences);
$favicon = $this->head('favicon', 'admin', $this->preferences);
$rss     = '';

$baseURL = BASE_URL;

$siteTitle = '<h1><a href="'.$baseURL.'/" title="">'.stripcslashes($this->preferences['site_title'])."</a></h1>\n";

$report = '';
if(count($this->report) > 0)
	{
		$report = "\n<div id=\"report\">\n\t".stripslashes($this->report[0])."</div>\n";
	}

$helloLogout = $this->helloLogout($this->userInfo['user_name'], $baseURL);
$menu = $this->mainMenu(Aveghe_View_Helper_MainMenu::PREFERENCES, $baseURL);
$content = '
	
	<h2>Preferenze</h2>
	
	<form id="formPreferences" action="'.$baseURL.'/preferences/save" method="post">
		<fieldset>
			<legend>Generale</legend>	
			<p class="borderTop">
				<label for="site_author">Autore del Blog</label>
				<input type="text" class="text" id="site_author" name="site_author" value="'.htmlentities(stripcslashes($this->preferences['site_author'])).'" />
				
				<label for="site_title">Titolo del Blog</label>
				<input type="text" class="text" id="site_title" name="site_title" value="'.htmlentities(stripcslashes($this->preferences['site_title'])).'" />
				
				<label for="site_description">Descrizione del Blog</label>
				<textarea id="site_description" name="site_description" rows="10" cols="40">'.htmlentities(stripcslashes($this->preferences['site_description'])).'</textarea>
				
				<label for="site_keywords">Parole chiave (separate da virgole)</label>
				<textarea id="site_keywords" name="site_keywords" rows="10" cols="40">'.$this->preferences['site_keywords'].'</textarea>
				
				<label for="site_home_item_num">Numero di post in home page</label>
				<input type="text" class="text" id="site_home_item_num" name="site_home_item_num" value="'.$this->preferences['site_home_item_num'].'" />
				
			</p>
		</fieldset>
		
		<fieldset>
			<legend>Temi</legend>
			<p class="borderTop"></p>
		</fieldset>
		
		<fieldset>
			<legend>RSS</legend>
			<p class="borderTop">
				<label for="site_rss_uri">URI del feed RSS</label>
				<input type="text" class="text" id="site_rss_uri" name="site_rss_uri" value="'.$this->preferences['site_rss_uri'].'" />
				
				<label for="site_rss_item_num">Numero di news nel feed RSS</label>
				<input type="text" class="text" id="site_rss_item_num" name="site_rss_item_num" value="'.$this->preferences['site_rss_item_num'].'" />
			</p>
		</fieldset>
		
		<fieldset>
			<legend>Commenti</legend>
			<p class="borderTop">
				<label for="site_comments">Commento dei post</label>
				<select id="site_comments" name="site_comments">';

		if($this->preferences['site_comments'] == 'enable')
			$content .= '<option value="enable" selected="selected">Abilitato</option>';
		else
			$content .= '<option value="enable">Abilitato</option>';
			
		if($this->preferences['site_comments'] == 'moderated')
			$content .= '<option value="moderated" selected="selected">Moderato</option>';
		else
			$content .= '<option value="moderated">Moderato</option>';
			
		if($this->preferences['site_comments'] == 'disable')
			$content .= '<option value="disable" selected="selected">Disabilitato</option>';
		else
			$content .= '<option value="disable">Disabilitato</option>';

$content .= '
				</select>
			</p>
			
			<input class="submit" type="submit" value="Salva" />
		</fieldset>
	</form>

';

include 'aveghe/themes/admin/'.$this->preferences['site_admin_theme'].'/template_admin.xhtml';
?>